cmake_minimum_required(VERSION 3.4.1)

set(distribution_DIR ${CMAKE_SOURCE_DIR}/src/main/jniLibs)

include_directories(${distribution_DIR}/include)
#include_directories(${CMAKE_SOURCE_DIR}/src/main/jni)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/main/jni JNI_DIR)
#list(APPEND SRC_DIR ${MATRIX_LIB_DIR})

# --------------------------------------- cloudplatform-media --------------------
add_library(
    cloudplatform-media
    SHARED
    ${JNI_DIR}
)

# --------------------------------------- avcodec-57 --------------------
add_library(
    avcodec-57
    SHARED
    IMPORTED
)
set_target_properties(
    avcodec-57
    PROPERTIES IMPORTED_LOCATION
    ${distribution_DIR}/${ANDROID_ABI}/libavcodec-57.so
)

# --------------------------------------- avdevice-57 --------------------
add_library(
    avdevice-57
    SHARED
    IMPORTED
)
set_target_properties(
    avdevice-57
    PROPERTIES IMPORTED_LOCATION
    ${distribution_DIR}/${ANDROID_ABI}/libavdevice-57.so
)

# --------------------------------------- avfilter-6 --------------------
add_library(
    avfilter-6
    SHARED
    IMPORTED
)
set_target_properties(
    avfilter-6
    PROPERTIES IMPORTED_LOCATION
    ${distribution_DIR}/${ANDROID_ABI}/libavfilter-6.so
)

# --------------------------------------- avformat-57 --------------------
add_library(
    avformat-57
    SHARED
    IMPORTED
)
set_target_properties(
    avformat-57
    PROPERTIES IMPORTED_LOCATION
    ${distribution_DIR}/${ANDROID_ABI}/libavformat-57.so
)

# --------------------------------------- avutil-55 --------------------
add_library(
    avutil-55
    SHARED
    IMPORTED
)
set_target_properties(
    avutil-55
    PROPERTIES IMPORTED_LOCATION
    ${distribution_DIR}/${ANDROID_ABI}/libavutil-55.so
)

# --------------------------------------- postproc-54 --------------------
add_library(
    postproc-54
    SHARED
    IMPORTED
)
set_target_properties(
    postproc-54
    PROPERTIES IMPORTED_LOCATION
    ${distribution_DIR}/${ANDROID_ABI}/libpostproc-54.so
)

# --------------------------------------- swresample-2 --------------------
add_library(
    swresample-2
    SHARED
    IMPORTED
)
set_target_properties(
    swresample-2
    PROPERTIES IMPORTED_LOCATION
    ${distribution_DIR}/${ANDROID_ABI}/libswresample-2.so
)

# --------------------------------------- swscale-4 --------------------
add_library(
    swscale-4
    SHARED
    IMPORTED
)
set_target_properties(
    swscale-4
    PROPERTIES IMPORTED_LOCATION
    ${distribution_DIR}/${ANDROID_ABI}/libswscale-4.so
)



# --------------------------------------- log --------------------
find_library(
    log-lib
    log
)

#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")

target_link_libraries(
    cloudplatform-media
    avcodec-57 avdevice-57 avfilter-6 avformat-57 avutil-55 postproc-54 swresample-2 swscale-4
    ${log-lib}
)


